home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / emulator / st / saverom.pas < prev    next >
Pascal/Delphi Source File  |  1994-09-21  |  1KB  |  36 lines

  1. PROGRAM SaveROM;
  2. { (C) by Stefan Haubenthal 1993/94 }
  3. { DISCLAIMER:  Usage of this image file is reserved for those users who
  4. are already in posession of an Atari ST and thus having a legal right to
  5. use the ROM software. This method is intended for those who lack the ability
  6. to extract the image due to hardware shortcomings or system damage. }
  7.  
  8. USES    DOS;
  9. CONST   Name='TOS.IMG';
  10.         Len=$4000;
  11. VAR     PtrROM,ROM:^LongInt;
  12.         SP : Pointer;   { Used to save stack pointer. }
  13.         Image:FILE;
  14.         Max:INTEGER;
  15.         Block:LongInt;
  16.         Buffer:PACKED ARRAY [1..Len] OF Byte;
  17.  
  18. BEGIN
  19. Sp := Super(NIL);     { Enter Supervisor mode. }
  20. PtrROM:=Ptr($4f2);
  21. ROM:=Ptr(PtrROM^);
  22. WriteLn('Saving ',Name,' V',LoWord(Hi(ROM^)),'.',LoWord(Lo(ROM^)));
  23. ReWrite(Image,Name);
  24. Max:=$30000 DIV Len-1;
  25. FOR Block:=0 TO Max DO
  26.         BEGIN
  27.         ROM:=Ptr(PtrROM^+Block*Len);
  28.         IF Block<Max THEN Move(ROM^,Buffer,Len)
  29.                      ELSE BEGIN
  30.                           Move(ROM^,Buffer,Len-1);
  31.                           Buffer[Len]:=$5c;
  32.                           END;
  33.         BlockWrite(Image,Buffer,Len);
  34.         END;
  35. END.
  36.